load("@io_bazel_rules_go//go:def.bzl", "go_test")
load("@rules_oci//oci:defs.bzl", "oci_image")
load("@rules_pkg//:pkg.bzl", "pkg_tar")

pkg_tar(
    name = "conformance-config",
    testonly = True,
    srcs = [":conformance-config.json"],
    package_dir = "/",
)

pkg_tar(
    name = "conformance-tests",
    testonly = True,
    srcs = [
        ":go_default_test",
        "//tests/conformance",
    ],
    package_dir = "/usr/bin",
)

oci_image(
    name = "conformance_image_base",
    testonly = True,
    base = "//:passwd-image",
    tars = [
        ":conformance-config",
    ],
    visibility = ["//visibility:public"],
)

oci_image(
    name = "conformance_image",
    testonly = True,
    base = ":conformance_image_base",
    entrypoint = ["/usr/bin/conformance"],
    tars = [
        ":conformance-tests",
    ],
    visibility = ["//visibility:public"],
)

go_test(
    name = "go_default_test",
    srcs = [
        "access_test.go",
        "canary_upgrade_test.go",
        "clone_test.go",
        "config_test.go",
        "container_disk_test.go",
        "dryrun_test.go",
        "hyperv_test.go",
        "mdev_configuration_allocation_test.go",
        "objectgraph_test.go",
        "pool_test.go",
        "portforward_test.go",
        "replicaset_test.go",
        "security_features_test.go",
        "stability_test.go",
        "swap_test.go",
        "sysprep_test.go",
        "tests_suite_test.go",
        "version_test.go",
        "virt-handler_test.go",
        "virt_control_plane_test.go",
        "vm_state_test.go",
        "vm_test.go",
        "vmi_cloudinit_hook_sidecar_test.go",
        "vmi_cloudinit_test.go",
        "vmi_configuration_test.go",
        "vmi_headless_test.go",
        "vmi_hook_sidecar_test.go",
        "vmi_hostdev_test.go",
        "vmi_ignition_test.go",
        "vmi_iothreads_test.go",
        "vmi_kernel_boot_test.go",
        "vmi_lifecycle_test.go",
        "vmi_multiqueue_test.go",
        "vmi_sound_test.go",
        "vmi_tpm_test.go",
        "vmi_vsock_test.go",
        "vmipreset_test.go",
        "vnc_test.go",
        "watchdog_test.go",
        "windows_test.go",
    ],
    data = glob(["testdata/**"]),
    embedsrcs = ["testdata/sidecar-hook-configmap.sh"],
    visibility = ["//visibility:public"],
    deps = [
        "//pkg/apimachinery/patch:go_default_library",
        "//pkg/apimachinery/wait:go_default_library",
        "//pkg/cloud-init:go_default_library",
        "//pkg/config:go_default_library",
        "//pkg/controller:go_default_library",
        "//pkg/hooks:go_default_library",
        "//pkg/hooks/v1alpha1:go_default_library",
        "//pkg/hooks/v1alpha2:go_default_library",
        "//pkg/hooks/v1alpha3:go_default_library",
        "//pkg/libdv:go_default_library",
        "//pkg/libvmi:go_default_library",
        "//pkg/libvmi/cloudinit:go_default_library",
        "//pkg/libvmi/replicaset:go_default_library",
        "//pkg/network/dns:go_default_library",
        "//pkg/pointer:go_default_library",
        "//pkg/testutils:go_default_library",
        "//pkg/util/hardware:go_default_library",
        "//pkg/util/net/dns:go_default_library",
        "//pkg/virt-api:go_default_library",
        "//pkg/virt-config/featuregate:go_default_library",
        "//pkg/virt-controller/services:go_default_library",
        "//pkg/virt-controller/watch/topology:go_default_library",
        "//pkg/virt-handler/device-manager:go_default_library",
        "//pkg/virt-handler/node-labeller/util:go_default_library",
        "//pkg/virt-launcher/virtwrap/api:go_default_library",
        "//staging/src/kubevirt.io/api/clone/v1beta1:go_default_library",
        "//staging/src/kubevirt.io/api/core:go_default_library",
        "//staging/src/kubevirt.io/api/core/v1:go_default_library",
        "//staging/src/kubevirt.io/api/instancetype:go_default_library",
        "//staging/src/kubevirt.io/api/instancetype/v1beta1:go_default_library",
        "//staging/src/kubevirt.io/api/pool:go_default_library",
        "//staging/src/kubevirt.io/api/pool/v1beta1:go_default_library",
        "//staging/src/kubevirt.io/api/snapshot:go_default_library",
        "//staging/src/kubevirt.io/api/snapshot/v1beta1:go_default_library",
        "//staging/src/kubevirt.io/client-go/kubecli:go_default_library",
        "//staging/src/kubevirt.io/client-go/kubevirt/typed/core/v1:go_default_library",
        "//staging/src/kubevirt.io/client-go/log:go_default_library",
        "//staging/src/kubevirt.io/client-go/reporter:go_default_library",
        "//staging/src/kubevirt.io/client-go/subresources:go_default_library",
        "//tests/compute:go_default_library",
        "//tests/compute/subresources:go_default_library",
        "//tests/console:go_default_library",
        "//tests/containerdisk:go_default_library",
        "//tests/decorators:go_default_library",
        "//tests/events:go_default_library",
        "//tests/exec:go_default_library",
        "//tests/flags:go_default_library",
        "//tests/framework/checks:go_default_library",
        "//tests/framework/cleanup:go_default_library",
        "//tests/framework/kubevirt:go_default_library",
        "//tests/framework/matcher:go_default_library",
        "//tests/guestlog:go_default_library",
        "//tests/hotplug:go_default_library",
        "//tests/infrastructure:go_default_library",
        "//tests/instancetype:go_default_library",
        "//tests/launchsecurity:go_default_library",
        "//tests/libconfigmap:go_default_library",
        "//tests/libdomain:go_default_library",
        "//tests/libinfra:go_default_library",
        "//tests/libinstancetype:go_default_library",
        "//tests/libkubevirt:go_default_library",
        "//tests/libkubevirt/config:go_default_library",
        "//tests/libmigration:go_default_library",
        "//tests/libnet:go_default_library",
        "//tests/libnet/cloudinit:go_default_library",
        "//tests/libnode:go_default_library",
        "//tests/libpod:go_default_library",
        "//tests/libregistry:go_default_library",
        "//tests/libreplicaset:go_default_library",
        "//tests/libsecret:go_default_library",
        "//tests/libstorage:go_default_library",
        "//tests/libvmifact:go_default_library",
        "//tests/libvmops:go_default_library",
        "//tests/libwait:go_default_library",
        "//tests/migration:go_default_library",
        "//tests/monitoring:go_default_library",
        "//tests/network:go_default_library",
        "//tests/numa:go_default_library",
        "//tests/operator:go_default_library",
        "//tests/performance:go_default_library",
        "//tests/realtime:go_default_library",
        "//tests/reporter:go_default_library",
        "//tests/storage:go_default_library",
        "//tests/testsuite:go_default_library",
        "//tests/usb:go_default_library",
        "//tests/validatingadmissionpolicy:go_default_library",
        "//tests/virtctl:go_default_library",
        "//tests/virtiofs:go_default_library",
        "//tests/watcher:go_default_library",
        "//tools/vms-generator/utils:go_default_library",
        "//vendor/github.com/google/goexpect:go_default_library",
        "//vendor/github.com/google/uuid:go_default_library",
        "//vendor/github.com/gorilla/websocket:go_default_library",
        "//vendor/github.com/onsi/ginkgo/v2:go_default_library",
        "//vendor/github.com/onsi/ginkgo/v2/reporters:go_default_library",
        "//vendor/github.com/onsi/gomega:go_default_library",
        "//vendor/github.com/onsi/gomega/format:go_default_library",
        "//vendor/github.com/onsi/gomega/gmeasure:go_default_library",
        "//vendor/github.com/onsi/gomega/gstruct:go_default_library",
        "//vendor/golang.org/x/crypto/ssh:go_default_library",
        "//vendor/k8s.io/api/apps/v1:go_default_library",
        "//vendor/k8s.io/api/authorization/v1:go_default_library",
        "//vendor/k8s.io/api/autoscaling/v1:go_default_library",
        "//vendor/k8s.io/api/core/v1:go_default_library",
        "//vendor/k8s.io/api/node/v1:go_default_library",
        "//vendor/k8s.io/api/policy/v1beta1:go_default_library",
        "//vendor/k8s.io/apimachinery/pkg/api/errors:go_default_library",
        "//vendor/k8s.io/apimachinery/pkg/api/resource:go_default_library",
        "//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
        "//vendor/k8s.io/apimachinery/pkg/apis/meta/v1beta1:go_default_library",
        "//vendor/k8s.io/apimachinery/pkg/fields:go_default_library",
        "//vendor/k8s.io/apimachinery/pkg/runtime:go_default_library",
        "//vendor/k8s.io/apimachinery/pkg/types:go_default_library",
        "//vendor/k8s.io/apimachinery/pkg/util/intstr:go_default_library",
        "//vendor/k8s.io/apimachinery/pkg/util/json:go_default_library",
        "//vendor/k8s.io/apimachinery/pkg/util/rand:go_default_library",
        "//vendor/k8s.io/apimachinery/pkg/util/wait:go_default_library",
        "//vendor/k8s.io/apimachinery/pkg/version:go_default_library",
        "//vendor/k8s.io/apimachinery/pkg/watch:go_default_library",
        "//vendor/k8s.io/client-go/informers:go_default_library",
        "//vendor/k8s.io/client-go/kubernetes/scheme:go_default_library",
        "//vendor/k8s.io/client-go/kubernetes/typed/authorization/v1:go_default_library",
        "//vendor/k8s.io/client-go/plugin/pkg/client/auth:go_default_library",
        "//vendor/k8s.io/client-go/rest:go_default_library",
        "//vendor/k8s.io/client-go/tools/cache:go_default_library",
        "//vendor/k8s.io/client-go/util/retry:go_default_library",
        "//vendor/k8s.io/utils/ptr:go_default_library",
        "//vendor/kubevirt.io/containerized-data-importer-api/pkg/apis/core/v1beta1:go_default_library",
        "//vendor/kubevirt.io/qe-tools/pkg/ginkgo-reporters:go_default_library",
    ],
)
